<template>
  <div>

    <div class="statistics-top">

      <el-checkbox
        v-model="checked"
        label="按终端价营销额统计"
        size="large"
        @change="boxChange"
      />

      <el-form>
        <el-form-item label="总回款营销额：">
          <span class="price-txt">{{ totalAmount.toFixed(2) }}元</span>
        </el-form-item>
      </el-form>

    </div>

    <one-product-view
      v-if="screen.type == 1"
      :table-data="tableData"
    />

    <two-product-view
      v-else
      :table-data="tableData"
    />

  </div>
</template>

<script>
import statistics from '@CRM/mixins/statisticsList.js'
import {defineComponent, defineAsyncComponent, onBeforeMount, toRefs} from 'vue'

export default defineComponent({
  name: 'Index',
  components: {
    oneProductView:defineAsyncComponent(()=>import('./oneProductView.vue')),
    twoProductView:defineAsyncComponent(()=>import('./twoProductView.vue'))
  },
  props: {
    screen: {
      type: Object,
      default: {},
    },
  },
  setup(props, {}) {
    const { data, getListData } = statistics(props.screen)

    onBeforeMount(() => {
      data.type = 'product'
    })

    return {
      ...toRefs(data),

      getListData,
    }
  },
})
</script>

<style scoped>
</style>
